<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>closure闭包</title>
</head>

<body>
    <script>
        function makePower(power) {
            return function (num) {
                return Math.pow(num, power);
            }
        }

        // 求平方
        let power2 = makePower(2);
        // console.log(power2(2));
        // console.log(power2(5));
        // 求立方
        let power3 = makePower(3);
        // console.log(power3(2));
    </script>
</body>

</html>